package com.yeti.domain;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.ManyToOne;

import org.hibernate.validator.constraints.Email;
import org.hibernate.validator.constraints.NotEmpty;

@Entity
@Inheritance(strategy=InheritanceType.JOINED)
public class User implements Serializable {


	private static final long serialVersionUID = 1L;
	
	@Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Integer id;

	@NotEmpty @Email @Column(unique=true)
	private String username;
	@NotEmpty
    private String password;
    private boolean enabled;
    
    @ManyToOne(targetEntity=Role.class)
    private Role role;
    
    public Integer getId(){
        return id;
    }

    public void setId(Integer id){
        this.id = id;
    } 

    public String getUsername() {
        return username;
    }
    
    public void setUsername(String username) {
        this.username = username;
    }
    
    public String getPassword() {
        return this.password;
    }
    
    public void setPassword(String password) {
        this.password = password;
    }
    
    public void setEnabled(boolean enabled) {
        this.enabled = enabled;
    }
    
    public boolean getEnabled(){
    	return enabled;
    }
    
    public void setRole(Role role){
    	this.role = role;
    }
    
    public Role getRole(){
    	return this.role;
    }
}
